package cn.z2huo.knowledge.concurrency.logicofjava.thread;

/**
 * <p>
 *
 * @author z2huo
 */
public class HelloThread extends Thread {

    @Override
    public void run() {
        System.out.println("thread name is " + Thread.currentThread().getName());
        System.out.println("hello");
    }

    public static void main(String[] args) throws InterruptedException {
        HelloThread helloThread = new HelloThread();
        helloThread.start();
        // main 线程中调用 helloThread 线程的 join 方法，main 线程会等待 helloThread 线程执行完毕
        helloThread.join();

        System.out.println();
        System.out.println("main thread");

        // main 线程永久阻塞，无法正常结束
        // 自我阻塞的死循环
        Thread.currentThread().join();

//        helloThread.run();
    }
}
